package thread;
//查看线程相关信息
public class ThreadInfoDemo {
    public static void main(String[] args) {
        Thread t1 = Thread.currentThread();//获得主线程
        //获取线程名
        String name = t1.getName();
        System.out.println(name);

        //获取唯一标识
        long id = t1.getId();
        System.out.println(id);

        //获得线程优先级
        int priority = t1.getPriority();
        System.out.println(priority);

        //是否是守护线程
        boolean daemon = t1.isDaemon();
        System.out.println(daemon);

        //查看是否活着
        boolean alive = t1.isAlive();
        System.out.println(alive);

        //查看是否中断
        boolean interrupted = t1.isInterrupted();
        System.out.println(interrupted);
    }
}
